<?php
/**
 * 
 *
 * @author Admin
 */
class Main_Form_Adminuser_Newuser extends WOW_Form_Abstract
{
    public $elementDecorators = array(
            'ViewHelper',

            array(array('data' => 'HtmlTag'), array('tag' => 'span' )),
            array('Label', array('tag' => 'div', 'class'  => 'flt col250')

            )
    );


    public function init()
    {
        // add path to custom validators
        $this->addElementPrefixPath(
            'Main_Validate',
            APPLICATION_PATH . '/modules/main/models/validate/',
            'validate'
        );

        $this->addElement('text', 'AdminUserName', array(
            'filters'    => array('StringTrim', 'StringToLower'),
            'validators' => array(
                array('StringLength', true, array(3, 128)),
                array('UniqueUsername', false, array(new Main_Model_Adminuser()))
            ),
            'required'  => true,
            'label'     => 'Username',
            'class'     => 'input-medium',
            'decorators'=> $this->elementDecorators
        ));

       $this->addElement('password', 'Password', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('StringLength', true, array(6, 128))
            ),
            'required'   => true,
            'label'      => 'Password',
           'class'     => 'input-medium',
           'decorators'=> $this->elementDecorators
        ));

        $this->addElement('password', 'passwdVerify', array(
            'filters'    => array('StringTrim'),
            'validators' => array(
               'PasswordVerification',
            ),
            'required'   => true,
            'label'      => 'Confirm Password',
            'class'     => 'input-medium',
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('select', 'role', array(
            'required'   => true,
            'label'      => 'Select Role',
            'multiOptions' => array( '0' => 'Select Role ...',  'Admin' => 'Admin', 'Moderator' => 'Moderator'),
            'decorators'=> $this->elementDecorators
        ));

        $this->addElement('submit', 'submit', array(
            'required' => false,
            'ignore'   => true,
            'value'    => 'Create'
        ));

         $this->addElement('hidden', 'id', array(
            'filters'    => array('StringTrim'),
            'decorators'=> $this->elementDecorators
        ));
        $this->setDecorators(array(
            'FormElements',
            array('HtmlTag', array('tag' => 'dl', 'class' => 'zend_form')),
            array('Description', array('placement' => 'prepend', 'class' => 'error')),
            'Form'
        ));
    }
}

?>
